﻿using System;
using System.Deployment.Application;
using System.Reflection;
using System.Windows;
using MovieModel.FileSystem;
using MovieModel.Model;

namespace MovieBuddy.Dialogs
{
    /// <summary>
    /// Interaction logic for AboutDialog.xaml
    /// </summary>
    public partial class AboutDialog : Window
    {
        public AboutDialog(Manager manager)
        {
            InitializeComponent();
            dataFolderLabel.Text = ((FileSystemManager) manager).Directory.FullName;
            versionLabel.Text = GetRunningVersion().ToString();
        }

        private Version GetRunningVersion()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                return ApplicationDeployment.CurrentDeployment.CurrentVersion;
            }
            return Assembly.GetExecutingAssembly().GetName().Version;
        }
    }
}
